window function
Windows can be assigned a window function when they are created by XgrCreateWindow(), or later by XgrSetWindowFunction().

XgrProcessMessages() calls the window function the message refers to directly or indirectly...

For window messages, XgrProcessMessages() calls the window function assigned to the window specified by the window argument.

For grid messages, XgrProcessMessages() calls the window function assigned to the window that contains the grid specified by the grid argument.

XgrProcessMessages() calls window functions as follows:

  @func (wingrid, message, v0, v1, v2, v3, 0, wingrid)

XgrProcessMessages() calls functions that expect eight XLONG arguments.

Window functions are usually declared and defined as follows:

  DECLARE FUNCTION Name (wingrid, message, v0, v1, v2, v3, r0, ANY)
  FUNCTION Name (wingrid, message, v0, v1, v2, v3, r0, (r1, r1$))

grid functions
When window functions receive a window message, they can ignore it or take some action. When finished, they return to the calling function, which is generally XgrProcessMessages() .

When window functions receive a grid message, they can ignore it, take some action, or pass it on to the grid function whose address was func in the XgrCreateGrid() call that created the grid. The easiest way to call grid functions is to pass the arguments to XgrSendMessage() and let XgrSendMessage() look up the grid function assigned to grid and call it, as in:

  XgrSendMessage (wingrid, message, v0, v1, v2, v3, 0, wingrid)

XgrSendMessage() calls only 8 argument functions, so all grid functions must take eight arguments. The first seven arguments are always XLONG , while the type of the last can be XLONG, STRING, a composite type, or an array of any valid type.

Grid functions are usually declared and defined as follows:

  DECLARE FUNCTION Name (grid, message, v0, v1, v2, v3, r0, ANY)
  FUNCTION Name (grid, message, v0, v1, v2, v3, r0, (r1, r1$))